struct ListNode* reverseList(struct ListNode* head){
        if(!head){
            return NULL;
        }
        struct ListNode *p = head->next;
        struct ListNode *q;
        head->next = NULL;
        while(p){
            q = p->next;
            p->next = head;
            head = p;
            p = q;
        }
        return head;
}
